<template>
  <div class="container">
<div :id="ids" :style="{width: '300px', height: '300px'}" style="float:left"></div>

  </div>
</template>  

<script>

export default {
  props:['xdata','ydata','ids','type'],
  // created(){
  //   this.$nextTick(function(){
  //     console.log('$nextTick')
  //   })
  // },
  mounted(){
    this.drawLine();
    // console.log('陈陈陈陈陈')
  },    
  methods: {   
    drawLine(){   
        // 基于准备好的dom，初始化echarts实例
        let myChart = this.$echarts.init(document.getElementById(this.ids))
        // 绘制图表
        //  myChart.setOption()也可以接收一整个对象变量
        myChart.setOption({
        
          xAxis: {
            type: 'category',
            data:this.xdata,
          },
          yAxis: {
              type: 'value'
          },
          series: [{
              data:this.ydata ,
              type: this.type
          }]
        });
    }
  }
}
</script>

<style scoped>

</style>
